package com.tbit.uqbike.object.pojo;


import com.tbit.common.entity.BaseEntity;
import com.tbit.uqbike.annos.Excel;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import java.util.HashMap;
import java.util.Map;

/**
 * 角色表 sys_role
 *
 * @author jing
 */
public class Role extends BaseEntity {
    private static final long serialVersionUID = 1L;

    /**
     * 角色ID
     */
    private Integer roleId;

    /**
     * 品牌id
     */
    private Integer accountId;

    /**
     * 品牌名称
     */
    private String accountName;

    /**
     * 角色名称
     */
    @Excel(name = "角色名称")
    private String roleName;

    /**
     * 角色权限
     */
    private String roleKey;

    /**
     * 角色排序
     */
    private String roleSort;

    @Excel(name = "角色级别", readConverterExp = "0=管理员,1=品牌,2=加盟商,3=运营区域")
    private String roleLevel;

    private String roleCode;

    private String roleValue;

    private String login;


    /**
     * 角色状态（0正常 1停用）
     */
    private String status;

    private String type;

    /**
     * 用户是否存在此角色标识 默认不存在
     */
    private boolean flag = false;

    /**
     * 菜单组
     */
    private Integer[] menuIds;

    /**
     * 运维端数据权限 （0全部，1仅自己）
     */
    private Integer dataPermission;
    /**
     * 运维端换电权限(0：所有，1：低电)
     */
    private Integer changeBattery;
    /**
     * 运维端调度权限(0：所有，1：闲置)
     */
    private Integer scheduling;
    /**
     * 运维端开锁车上限(0：无，1:有)
     */
    private Integer lockVehicle;
    /**
     * 运维端操作距离是否受限（0：无，1受限）
     */
    private Integer operatingDistance;
    /**
     * 运维端查看车辆电量权限（0：无，1受限）
     */
    private Integer lookBattery;
    /**
     * 是否只查询监管车辆（0：否，1是）
     */
    private Integer superviseMachine;

    /**
     * 备注
     */
    private String remark;

    private Map<String, Object> params;

    public Role() {

    }

    public Role(String roleValue) {
        this.roleValue = roleValue;
    }

    public Role(String roleLevel, String roleCode) {
        this.roleLevel = roleLevel;
        this.roleCode = roleCode;
    }

    public Role(Integer roleId) {
        this.roleId = roleId;
    }

    public static long getSerialVersionUID() {
        return serialVersionUID;
    }

    public static boolean isAdmin(Integer roleId) {
        return roleId != null && 0 == roleId;
    }

    public Integer getAccountId() {
        return accountId;
    }

    public void setAccountId(Integer accountId) {
        this.accountId = accountId;
    }

    public Integer getLookBattery() {
        return lookBattery;
    }

    public void setLookBattery(Integer lookBattery) {
        this.lookBattery = lookBattery;
    }

    public Integer getChangeBattery() {
        return changeBattery;
    }

    public void setChangeBattery(Integer changeBattery) {
        this.changeBattery = changeBattery;
    }

    public Integer getScheduling() {
        return scheduling;
    }

    public void setScheduling(Integer scheduling) {
        this.scheduling = scheduling;
    }

    public Integer getLockVehicle() {
        return lockVehicle;
    }

    public void setLockVehicle(Integer lockVehicle) {
        this.lockVehicle = lockVehicle;
    }

    public Integer getOperatingDistance() {
        return operatingDistance;
    }

    public void setOperatingDistance(Integer operatingDistance) {
        this.operatingDistance = operatingDistance;
    }

    public Integer getDataPermission() {
        return dataPermission;
    }

    public void setDataPermission(Integer dataPermission) {
        this.dataPermission = dataPermission;
    }

    public Integer getRoleId() {
        return roleId;
    }

    public void setRoleId(Integer roleId) {
        this.roleId = roleId;
    }

    public boolean isAdmin() {
        return isAdmin(roleId);
    }

    public String getRoleName() {
        return roleName;
    }

    public void setRoleName(String roleName) {
        this.roleName = roleName;
    }

    public String getRoleKey() {
        return roleKey;
    }

    public void setRoleKey(String roleKey) {
        this.roleKey = roleKey;
    }

    public String getRoleValue() {
        return roleValue;
    }

    public void setRoleValue(String roleValue) {
        this.roleValue = roleValue;
    }

    public String getRoleSort() {
        return roleSort;
    }


    public void setRoleSort(String roleSort) {
        this.roleSort = roleSort;
    }

    public String getRoleLevel() {
        return roleLevel;
    }

    public void setRoleLevel(String roleLevel) {
        this.roleLevel = roleLevel;
    }

    public String getRoleCode() {
        return roleCode;
    }

    public void setRoleCode(String roleCode) {
        this.roleCode = roleCode;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public boolean isFlag() {
        return flag;
    }

    public void setFlag(boolean flag) {
        this.flag = flag;
    }

    public Integer[] getMenuIds() {
        return menuIds;
    }

    public void setMenuIds(Integer[] menuIds) {
        this.menuIds = menuIds;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getLogin() {
        return login;
    }

    public void setLogin(String login) {
        this.login = login;
    }

    public Integer getSuperviseMachine() {
        return superviseMachine;
    }

    public void setSuperviseMachine(Integer superviseMachine) {
        this.superviseMachine = superviseMachine;
    }

    public String getAccountName() {
        return accountName;
    }

    public void setAccountName(String accountName) {
        this.accountName = accountName;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public Map<String, Object> getParams() {
        if (params == null) {
            params = new HashMap<>();
        }
        return params;
    }

    public void setParams(Map<String, Object> params) {
        this.params = params;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                .append("roleId", getRoleId())
                .append("roleName", getRoleName())
                .append("roleKey", getRoleKey())
                .append("roleSort", getRoleSort())
                .append("roleLevel", getRoleLevel())
                .append("roleCode", getRoleCode())
                .append("status", getStatus())
                .append("login", getLogin())
                .append("createTime", getCreateTime())
                .append("updateTime", getUpdateTime())
                .append("remark", getRemark())
                .toString();
    }


}
